1. The Field of the Invention
The present invention is directed to methods for buffering streaming data and, more particularly, to methods for enabling a device such as a programmable video recorder (PVR) to write and read non-byte streamed data in a backing store.
2. Related Technology
There are a variety of devices that have been developed throughout the years for increasing the convenience of watching and listening to broadcast data in a “time-shifted” manner. In other words, the broadcast data is displayed at a different time than it is received. The videocassette recorder (VCR), for example, is one such device. The VCR generally enables the viewer to record a broadcast and then later watch the broadcast at the viewer's leisure. The viewer can, for instance, use the VCR to selectively fast-forward, rewind, pause and replay the recording of the broadcast in a time-shifted manner.
One limitation of the traditional VCR, however, is that it cannot fast-forward, rewind, pause and replay the recorded broadcast while simultaneously recording a new broadcast. The primary reason for this is that the VCR cannot simultaneously write to and read from a videocassette. Another problem with the traditional VCR is that it is limited in its ability to access and provide the recorded data to the viewer in an expeditious manner. In particular, the speed at which the VCR can seek and obtain desired data is limited to the speed at which the VCR can fast-forward and rewind the videocassette containing the desired data.
The advent of broadcasting data in digital and streaming formats has allowed for many conveniences not considered practical for the VCR. For instance, digital data can be recorded and indexed on a hard disk or another type of mass storage device, thereby enabling the recorded data to be accessed promptly, without requiring the storage medium to be fast-forwarded and rewound in the sequential and time-consuming manner that is required for videocassettes. Another general benefit provided by digital data is that writing and reading digital data to a storage medium can occur simultaneously, such that the viewer can access previously recorded data without interrupting the recording of the new data. One drawback of digital data, however, is that it is file based, such that data within a file typically cannot be accessed and used until the entire contents of the file have been received.
Recently, however, certain standards have been developed which enable file based data to be encoded in a streaming format, such that the streamed data can be accessed and read at the same time it is being received, and without first requiring the entire contents of the streamed data file to be received. There are various standards and formats for streaming data. They include, but are not limited to, MPEG (Moving Picture Experts Group), ASF (Advanced Streaming Format), and AVI (Audio Video Interleave).
The programmable video recorder (PVR), or digital video recorder (DVR), is an example of one device that utilizes the benefits of digital data and which is capable of reading (and thus rendering) streamed data while it is being received. Nevertheless, there are many circumstances in which the PVR will store the streamed data for future use, rather than rendering the data at the rate or time it is received. For example, the streamed data may be received by the PVR at a faster rate than the PVR is capable of reading the streamed data. The PVR can also be directed by the viewer to intentionally read other data rather than the most recently received streamed data. For example, the viewer watching a program may wish to replay a previous event in the program, in which case the PVR is used to access and replay the previous event, during which time the reader is unable to read the most recently received streamed data. In yet another example, the viewer can use the PVR to temporarily pause the display of the program, during which time the reader is prohibited from reading, processing and rendering the streamed data altogether.
At any time in which the reader fails to read the streamed data at the rate it is received, the writer must store the streamed data so that it can be accessed and read at a later time. Otherwise, the data will be lost and inaccessible to the viewer later. Accordingly, in order to avoid losing data, existing PVR devices are configured with a ring buffer that is capable of temporarily storing the data until it is read. The ring buffer also temporarily stores data after it has been read, thereby enabling the viewer to quickly rewind and view previous events in the program.
FIG. 1 illustrates one example of an existing ring buffer 10 used by existing PVR devices to store streamed data. The ring buffer 10 essentially comprises memory disk storage that is accessed by a writer 20 and a reader 30 associated with the PVR. As illustrated in FIG. 1, streamed data 40 comprising data samples D1 thru D13 and so forth, which are (or will be) received by the writer 20 for writing to the ring buffer 10. In the illustrated example of FIG. 1, the data samples D1 thru D10 have been written in that order to the ring buffer 10, while data samples D11 thru D13 have not yet been written. Typically, the data is written to the ring buffer 10 in the order it is received. Once the streamed data 40 is written to the ring buffer 10, it is accessible to be read by the reader 30.
As mentioned above, there are certain circumstances, both intentional and unintentional, in which the streamed data 40 is received much more quickly than the reader 30 can read and render the streamed data 40. In these circumstances the writer 20 continues to write the streamed data 40 to the ring buffer 10 until the finite capacity of the ring buffer 10 is reached. Once the buffer 10 is completely full, the writer 20 must overwrite existing data or else the most recently received data will be lost. The most practical and common approach is to overwrite the oldest data samples contained within the ring buffer 10 so as to avoid losing the most recently received data samples. To illustrate this approach, FIG. 2 illustrates streamed data 40 as including data samples D3 through D21 and so forth, and represents that the writer 20 has also received data samples D11 through D18. Note that data sample D17 has overwritten data sample D1, data sample D18 has overwritten data sample D2, and data sample D19 will overwrite data sample D3, and so forth.
The utility of being able to independently and simultaneously write and read streamed data in a storage medium, such as ring buffer 10, provides the PVR a significant advantage over the traditional VCR. For example, the PVR enables a viewer to rewind and watch a replay of a previous event in a program, while at the same time the program continues to be broadcast, received and written to the ring buffer 10. In this manner, the PVR enables the viewer to later resume watching the program in a time-shifted manner, as desired, including the portions of the program that were broadcast and recorded during the time in which the viewer was watching the replay.
Despite the aforementioned benefits provided by the ring buffer 10, the ring buffer 10 has one significant disadvantage, which correspondingly limits the utility of the PVR. In particular, the ring buffer 10 can only support certain types of streamed data formats, such as MPEG, which can be wrapped in the manner described above in reference to FIGS. 1 and 2. In certain embodiments, MPEG refers to MPEG-2. However, it will be appreciated that the invention is not limited to embodiments in which MPEG is limited to MPEG-2.
Streamed data formats that cannot be wrapped include, but are not limited to, ASF and other non-byte stream formats. ASF, which is well-known to those of ordinary skill in the art, is a non-byte stream format provided by Microsoft Corporation that supports data delivery over a wide variety of networks and protocols while still proving suitable for local playback. ASF supports advanced multimedia capabilities including extensible media types, component download, scaleable media types, author-specified stream prioritization, multiple language support, and extensive bibliographic capabilities, including document and content management. It will be appreciated, however, that the invention is not limited to buffering ASF formatted data or any other particular type of non-byte stream formatted data.
One reason why non-byte stream formats cannot be wrapped is because doing so will corrupt or make inaccessible all of the previously recorded data even if the data was not overwritten in the file. For example, with reference to FIGS. 1 and 2, if streamed data 40 comprised an ASF format and data sample D1 included header information corresponding to the streamed data 40, once data sample D17 replaced data sample D1, the data samples of the streamed data 40 within the ring buffer 10 would be unreadable and essentially inaccessible to the reader 30, thereby frustrating the purposes for which the ring buffer 10 was established, namely, to store the streamed data 40 so it could be read at a later time. Accordingly, the utility of the PVR is limited inasmuch as ring buffers are unable to utilize streamed data that is formatted in non-byte stream formats.
Yet another problem experienced by the PVR is that the typical format of streamed data used by the PVR (e.g. MPEG) is compressed non-linearly with respect to time. For example, the first ten seconds of a program encoded in an MPEG format may comprise two megabytes, whereas the next ten seconds of the program may comprise three megabytes. This is a problem because the streamed data fills the buffer based on byte size, rather than on duration of content, thereby making it difficult for the PVR to know exactly where content having a particular time is located within the buffer.
For example, a viewer may wish to rewind the program five minutes. However, the PVR is only capable of rewinding the program by approximately five minutes because the rewind function is based on skipping over a block of data having a byte size that approximately corresponds to five minutes worth of content. However, because the actual byte size of the content that is skipped over is only approximate, the rewind function will also be only approximate.